#! /usr/bin/python

import math

fibo = [0, 1, 1]

for i in range(1, 10**6):
    fibo.append((fibo[i] + fibo[i+1])%10**9)

pan = set(['9', '8', '7', '6', '5', '4', '3', '2', '1'])
index = []
for i in range(2749, len(fibo)):
    if i > 2749 and set(str(fibo[i])) == pan:
	index.append(i)

#print index
phi = 1.6180339887

def top_digits(n):
    t = n * 0.20898764024997873 + (-0.3494850021680094)
    print t-int(t)+8
    t = int((pow(10, t - int(t) + 8)))
    
    return t

for i in index:
    if set(str(top_digits(i))) == pan:
        #print i
	break
# 433494437 
# 701408733
#1134903170 
#1836311903
#2971215073
#4807526976
#7778742049
